package org.iabako.shared.iservice.function;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.iabako.shared.entity.business.Sale;
import org.iabako.shared.entity.business.SaleProductService;
import org.iabako.shared.entity.user.Enterprise;
import org.iabako.shared.entity.user.EnterpriseCustomInfo;

import java.util.List;

/**
 * Created by jose on 05/02/15.
 */
public interface InvoiceGeneratorServiceAsync {

    void generateSampleInvoice(Enterprise transientEnterprise, List<EnterpriseCustomInfo> transientCustomInfoList, AsyncCallback<String> async);

    void generateInvoice(Sale sale, Long idPayment, String invoiceNumber, AsyncCallback<String> async);

    void sendInvoiceByEmail(Sale entity, Long idPayment, String invoiceNumber, String email, String subject, String body, AsyncCallback<Void> async);

    void generateInvoiceForQuote(Sale saleFromGWT, List<SaleProductService> productServiceList, AsyncCallback<String> async);

    void sendQuoteByEmail(Sale saleFromGWT, List<SaleProductService> productServiceList, String email, String subject, String body, AsyncCallback<Void> async);

    public static final class Util {
        private static InvoiceGeneratorServiceAsync instance;

        public static final InvoiceGeneratorServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(InvoiceGeneratorService.class);
            }
            return instance;
        }
    }
}
